<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>兑邀请码</title>
	<link rel="stylesheet" href="<?php echo IMG_PATH ?>bdkd/css/reset.css">
	<link rel="stylesheet" href="<?php echo IMG_PATH ?>bdkd/css/yao_scss.css">
	<script src="http://g.tbcdn.cn/mtb/lib-flexible/0.3.4/??flexible_css.js,flexible.js"></script>
	<script src="<?php echo IMG_PATH ?>bdkd/js/jquery-1.11.1.min.js"></script>
    <style>
        *{
            a:active{
                text-decoration:none;
            }
            a:link{
                text-decoration:none;
            }
            a:visited{
                text-decoration:none;
            }
            a:hover{
                text-decoration:none;
            }
        }
    </style>
</head>
<body>
	<div class="tupian">
		<img src="<?php echo IMG_PATH ?>bdkd/img/yao.png" alt="">
	</div>
	<div class="sj">
		<span class="86">+86 <input id="phone" class="ipt-one" type="text"  placeholder="请输入手机号" value="
		<?php
            if(!empty($is_get->phone)){
                echo $is_get->phone;
            }
            ?>

		"></span>
	</div>
	<a style="text-decoration: none;" href="#"><div class="ipt-three"
            <?php
            if(empty($is_get->phone)){
                ?>
                                                    onclick="addcode()"
                <?php
            }else{

?>                onclick="iscode()"
                                                    <?php
                }
            ?>


>确定</div></a>
	<script src="<?php echo IMG_PATH ?>bdkd/js/yao.js"></script>



</body>
<script type="text/javascript">

    function iscode() {
        alert("您已兑换邀请码,请勿重复操作!");
    }

    window.onload=function(){
        <?php
        if(!empty($is_get->phone)){
        ?>
        var code = $("#phone").val();
        $('#phone').attr('disabled','disabled').css('background','#fff').css('color','#ccc');
        $('.ipt-three').html('您已完成兑换');



        <?php
        }
        ?>
    }


    function addcode(){
        var code = $("#phone").val();
        if(code==0){
            alert('请输入推荐人手机号！');
            return false;
        }
//        $('#phone').attr('disabled','disabled').css('background','#fff').css('color','#ccc');
//        $('.ipt-three').html('您已完成兑换');
//       // alert(code);
        //return false;
        $.ajax({
            // 请求发送方式
            type: 'post',
            // 验证文件
            url: '<?php echo SITE_PATH ?>work/buser/addCode',
            dataType:'json',
            // 用户输入的帐号验证码
            data: {
                'code': code
            },
            success: function(data){
                console.log(data);
                if(data.result==1){
                    alert('提交成功!');
                }else {
                    alert(data.msg);
                }
            },
            error: function(){
                alert('提交失败!0');
            }

        })
    }
</script>
</html>